﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using BlawkayEngine;

namespace BlawkayHockey
{
    public class Wall
    {

        public Wall(Game oGame, string oImagePath, Vector3 oPosition, Vector3 oNormal, float oLength, float oHeight)
        {
            // Top
            Texture2D oTexture = oGame.Content.Load<Texture2D>(oImagePath);

            int height = 512;
            int length = 512;
            int boardHeight = (int)(height * 0.33f);
            int glassHeight = height - boardHeight;

            _Board = new Quad(oGame, oTexture, 
                new Rectangle(0, glassHeight, length, boardHeight),
                oPosition, new Vector3(0, (oHeight * 0.33f) * 0.5f + -0.2f, 0f),
                oNormal, VectorHelper.GLOBAL_UP, oLength, oHeight * 0.33f, false);

            _Glass = new Quad(oGame, oTexture,
                new Rectangle(0, 0, length, glassHeight),
                oPosition, new Vector3(0.2f, (oHeight * 0.33f) + (oHeight * 0.67f) * 0.5f + -0.2f, 0f),
                oNormal, VectorHelper.GLOBAL_UP, oLength, oHeight * 0.67f, false);
        }

        public void Update(Camera oCamera)
        {
            _Board.Update(oCamera);
            _Glass.Update(oCamera);
        }

        public void DrawOpaque(Game oGame)
        {
            _Board.Draw(oGame);
        }

        public void DrawAlpha(Game oGame)
        {
            _Glass.Draw(oGame);
        }

        Quad _Board;
        Quad _Glass;

    }

}
